package com.maixun.lib_base.mvp

import com.maixun.lib_base.observer.NetBaseObserver
import io.reactivex.disposables.CompositeDisposable
import io.reactivex.disposables.Disposable

/**
 * 作者：Lmoumou
 * 时间：2020/7/15 09:42
 */
abstract class BasePresenterImpl<V : BaseContract.BaseView, M : BaseContract.BaseModel>(protected val mView: V) :
    BaseContract.BasePresenter {

    protected abstract val mModel: M

    private val compositeDisposable: CompositeDisposable by lazy { CompositeDisposable() }

    override fun addDisposable(d: Disposable) {
        compositeDisposable.add(d)
    }

    override fun detachView() {
        if (!compositeDisposable.isDisposed) {
            compositeDisposable.dispose()
        }
    }

    abstract inner class CommentObserver<T> : NetBaseObserver<T>(mView, this) {

    }
}